package cn.buk.tms.entity.misc;

import cn.buk.tms.entity.base.BaseOrderInfo;
import cn.buk.tms.entity.order.OrderApprovalInfo;

import jakarta.persistence.*;
import java.util.Date;

/**
 * 租车订单
 * @author yfdai
 */
@Entity
@Table(name = "rental_car_order",
        uniqueConstraints = @UniqueConstraint(
                name = "uk_rental_car_order",
                columnNames = {"enterprise_id", "order_no"}))
@AssociationOverrides({
        @AssociationOverride(name = "customer",
                joinColumns = @JoinColumn(name = "customer_id"),
                foreignKey = @ForeignKey(name = "fk_car_order_customer")
        ),
        @AssociationOverride(name = "supplier",
                joinColumns = @JoinColumn(name = "supplier_id"),
                foreignKey = @ForeignKey(name = "fk_rental_car_order_supplier")
        ),
        @AssociationOverride(name = "paymentMethod",
                joinColumns = @JoinColumn(name = "payment_method_id"),
                foreignKey = @ForeignKey(name = "fk_rental_car_order_payment_method")
        )
})
public class RentalCarOrder extends BaseOrderInfo {


  /**
   * 订单号
   */
  @Column(name = "order_no", length = 10)
  private String orderNo;

  /**
   * 供应商订单号
   */
  @Column(name = "supplier_order_no", length = 20)
  private String supplierOrderNo;


  /**
   * 客户企业ID
   */
  @Column(name = "customer_enterprise_id")
  private int customerEnterpriseId;



  /**
   * 用车类型
   * 1-接飞机，2-送飞机，3-接火车，4-送火车, 99-其它
   */
  @Column(name = "use_type")
  private int useType;


  /**
   * 用车城市ID
   */
  @Column(name = "city_id")
  private int cityId;

  /**
   * 用车城市名称
   */
  @Column(name = "city_name", length = 100)
  private String cityName;

  /**
   * 接送的机场代码
   */
  @Column(name = "airport_code", length = 3)
  private String airportCode;

  /**
   * 航班号
   */
  @Column(name = "flight_no", length = 10)
  private String flightNo;

  /**
   * 出发地址
   */
  @Column(name = "departure_addr")
  private String departureAddress;

  /**
   * 到达地址
   */
  @Column(name = "arrival_addr")
  private String arrivalAddress;

  /**
   * 出发地址的经度
   */
  @Column(name = "d_longtitue")
  private String departureLongitude;

  /**
   * 出发地址的纬度
   */
  @Column(name = "d_latitue")
  private String departureLatitude;

  /**
   * 到达地址的经度
   */
  @Column(name = "a_longtitue")
  private String arrivalLongitude;

  /**
   * 到达地址的纬度
   */
  @Column(name = "a_latitue")
  private String arrivalLatitude;

  /**
   * 用车时间
   */
  @Temporal(TemporalType.TIMESTAMP)
  @Column(name = "use_time")
  private Date useTime;


  /**
   * //DONE 此车型组ID和名称需要保存本地的
   * 车型（组）ID
   */
  @Column(name = "vehicle_type_id")
  private Integer vehicleTypeId;

  /**
   * 车型组名称
   */
  @Column(name = "vehicle_type_name")
  private String vehicleTypeName;

  /**
   * 供应商车型组id
   */
  @Column(name = "supplier_vehicle_type_id")
  private Integer supplierVehicleTypeId;


  /**
   * 价格
   */
  private Double price;

  /**
   * 优惠金额
   */
  private Double discount;

  @Column(name = "service_charge")
  private Double serviceCharge;

  /**
   * 成本
   */
  private Double cost;

  /**
   * 利润
   */
  private Double profit;

  /**
   * 客户手机
   */
  private String mobile;

  /**
   * 客户姓名
   */
  private String name;

  /**
   * 客户电子邮件地址
   */
  private String email;

  /**
   * 订单状态
   * 0-未提交状态
   * 1-已提交，待处理
   * 2-处理中
   * 4-已取消
   * 8-处理完成
   */
  private int status;


  /**
   * 客户付款状态
   * 收款状态，收到采购的订单款项情况
   * 0/null: 未收款
   * 1: 已收款
   */
  @Column(name = "receipt_status")
  private Integer payStatus;

  /**
   * 付款状态：支付给供应商的款项情况
   * 0/null: 未支付
   * 1: 已支付
   */
  @Column(name = "payment_status")
  private Integer paymentStatus;

  /**
   * 订单提交日期
   */
  @Temporal(TemporalType.DATE)
  @Column(name = "create_date")
  private Date createDate;

  /**
   * 订单完成日期
   */
  @Temporal(TemporalType.DATE)
  @Column(name = "finished_date")
  private Date finishedDate;


  private String remark;




  /**
   * 审批信息
   */
  @Embedded
  private OrderApprovalInfo approvalInfo;






  public int getUseType() {
    return useType;
  }

  public void setUseType(int useType) {
    this.useType = useType;
  }

  public int getCityId() {
    return cityId;
  }

  public void setCityId(int cityId) {
    this.cityId = cityId;
  }

  public String getAirportCode() {
    return airportCode;
  }

  public void setAirportCode(String airportCode) {
    this.airportCode = airportCode;
  }

  public String getDepartureAddress() {
    return departureAddress;
  }

  public void setDepartureAddress(String departureAddress) {
    this.departureAddress = departureAddress;
  }

  public String getArrivalAddress() {
    return arrivalAddress;
  }

  public void setArrivalAddress(String arrivalAddress) {
    this.arrivalAddress = arrivalAddress;
  }

  public String getDepartureLongitude() {
    return departureLongitude;
  }

  public void setDepartureLongitude(String departureLongitude) {
    this.departureLongitude = departureLongitude;
  }

  public String getDepartureLatitude() {
    return departureLatitude;
  }

  public void setDepartureLatitude(String departureLatitude) {
    this.departureLatitude = departureLatitude;
  }

  public String getArrivalLongitude() {
    return arrivalLongitude;
  }

  public void setArrivalLongitude(String arrivalLongitude) {
    this.arrivalLongitude = arrivalLongitude;
  }

  public String getArrivalLatitude() {
    return arrivalLatitude;
  }

  public void setArrivalLatitude(String arrivalLatitude) {
    this.arrivalLatitude = arrivalLatitude;
  }

  public Date getUseTime() {
    return useTime;
  }

  public void setUseTime(Date useTime) {
    this.useTime = useTime;
  }

  public String getOrderNo() {
    return orderNo;
  }

  public void setOrderNo(String orderNo) {
    this.orderNo = orderNo;
  }

  public Double getPrice() {
    return price;
  }

  public void setPrice(Double price) {
    this.price = price;
  }

  public String getMobile() {
    return mobile;
  }

  public void setMobile(String mobile) {
    this.mobile = mobile;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getStatus() {
    return status;
  }

  public void setStatus(int status) {
    this.status = status;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }


  public String getFlightNo() {
    return flightNo;
  }

  public void setFlightNo(String flightNo) {
    this.flightNo = flightNo;
  }


  public Date getFinishedDate() {
    return finishedDate;
  }

  public void setFinishedDate(Date finishedDate) {
    this.finishedDate = finishedDate;
  }

  public Date getCreateDate() {
    return createDate;
  }

  public void setCreateDate(Date createDate) {
    this.createDate = createDate;
  }

  public Double getCost() {
    return cost;
  }

  public void setCost(Double cost) {
    this.cost = cost;
  }

  public Double getProfit() {
    return profit;
  }

  public void setProfit(Double profit) {
    this.profit = profit;
  }

  public int getPaymentStatus() {
    return paymentStatus == null ? 0 : paymentStatus;
  }

  public void setPaymentStatus(Integer paymentStatus) {
    this.paymentStatus = paymentStatus;
  }

  public String getSupplierOrderNo() {
    return supplierOrderNo;
  }

  public void setSupplierOrderNo(String supplierOrderNo) {
    this.supplierOrderNo = supplierOrderNo;
  }

  public Integer getVehicleTypeId() {
    return vehicleTypeId;
  }

  public void setVehicleTypeId(Integer vehicleTypeId) {
    this.vehicleTypeId = vehicleTypeId;
  }

  public String getVehicleTypeName() {
    return vehicleTypeName;
  }

  public void setVehicleTypeName(String vehicleTypeName) {
    this.vehicleTypeName = vehicleTypeName;
  }




  public int getCustomerEnterpriseId() {
    return customerEnterpriseId;
  }

  public void setCustomerEnterpriseId(int customerEnterpriseId) {
    this.customerEnterpriseId = customerEnterpriseId;
  }

  public String getCityName() {
    return cityName;
  }

  public void setCityName(String cityName) {
    this.cityName = cityName;
  }

  public double getDiscount() {
    return discount == null ? 0 : discount;
  }

  public void setDiscount(Double discount) {
    this.discount = discount;
  }

  public int getPayStatus() {
    return payStatus == null ? 0 : payStatus;
  }

  public void setPayStatus(Integer payStatus) {
    this.payStatus = payStatus;
  }


  public OrderApprovalInfo getApprovalInfo() {
    return approvalInfo;
  }

  public void setApprovalInfo(OrderApprovalInfo approvalInfo) {
    this.approvalInfo = approvalInfo;
  }

  public Integer getSupplierVehicleTypeId() {
    return supplierVehicleTypeId;
  }

  public void setSupplierVehicleTypeId(Integer supplierVehicleTypeId) {
    this.supplierVehicleTypeId = supplierVehicleTypeId;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }


  public double getServiceCharge() {
    return serviceCharge == null ? 0 : serviceCharge;
  }

  public void setServiceCharge(Double serviceCharge) {
    this.serviceCharge = serviceCharge;
  }
}
